package com.tps.cloud.system.controller;

import com.tps.cloud.response.Result;
import com.tps.cloud.system.dto.SystemMenuDto;
import com.tps.cloud.system.service.SystemMenuService;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 菜单管理 前端控制器
 */
@RestController
@AllArgsConstructor
@RequestMapping("/system/menu")
public class SystemMenuController {

    private final SystemMenuService systemMenuService;

    @PostMapping
    @Operation(summary = "创建菜单")
    public Result<Long> save(@Valid @RequestBody SystemMenuDto systemMenuDto) {
        Long menuId=systemMenuService.createMenu(systemMenuDto);
        return Result.ok(menuId);
    }
}
